<template>
    <div style="display: flex;justify-content: center;align-items: center;height: 100%;">
      <div style="display: flex;flex-direction: column">
        <div style="margin-bottom: 6px;">无当前页面信息,即将跳转到首页 {{ sec }}秒</div>
        <el-button @click="jumpHome" size="small">立即到首页</el-button>
      </div>
    </div>
  </template>
  
  <script>
  
  export default {
    name: 'page404',
    data(){
      return {
        sec: 3
      }
    },
    mounted(){
      this.goHome()
    },
    methods:{
      jumpHome(){
        this.clear()
        this.$router.push({
          path:"/home"
        })
      },
      goHome(){
       this.timer =  setInterval(()=>{
          this.sec -=1;
          if(this.sec<= 0){
            this.clear()
            this.$router.push({
              path:'/'
            })
          }
        },1000)
      },
      clear(){
        this.sec = 0;
            clearTimeout(this.timer)
            this.timer = null;
      }
    },
    beforeDestroy(){
      this.clear()

    }
  }
  </script>
  
  <style lang = "scss">

  </style>
  